Fgetcsv cannot read Chinese characters. setlocale (LC_ALL, 'zh _ CN ') has been set. However, when reading csv files, sometimes Chinese characters in the csv files cannot be read. why? It seems to be related to the system!
Reply to discussion
In php, the fgetcsv function imports the csv file into the mysql database. This article will introduce the fgetcsv function to the specific functions of the mysql database for importing csv files. you can also find a solution to Chinese garbled
SetLocale (Lc_all, ' ZH_CN ') has been set, but sometimes it is not possible to read the Chinese in the CSV file, why? It seems to be related to the system system!
Reply to discussion (solution)
Document encoding and system coding are the
This article will introduce the fgetcsv function to the specific functions of the mysql database for importing csv files. You can also find a solution to Chinese garbled characters.
When processing a large volume of excel Data to the mysql database,
PHP's ability to handle strings is very powerful, and there are a variety of ways, but sometimes you need to choose the simplest and most desirable solution. This article lists 10 common string processing cases in PHP, and provides the most
Php extracts strings from csv files. The fgetcsv () function is required for php Data in csv format. The fgetcsv () function is used for php Data with csv format in the file.
Use the following statement
Export hd1_fopen('test.csv ', 'r ');
$ Buf =
How to convert data from GB2312 to UTF-8 I tried both iconv and mb_convert_encoding, and then found that the results are the same, there will be various problems, it's a direct error. how can this problem be solved?
Reply to discussion
PHP uses the Fgetcsv () function for data in CSV format.
Use the following statement
$hd =fopen (' test.csv ', ' R '); $buf =fgetcsv ($HD, 1000, ', ');Opens a Test.csv formatted file with the contents of the file separated by the "," number.
The
The fgetcsv () function is required for php Data with the csv & amp; 26684; format. Use the following statement $ hd = fopen (& 039; testcsv & 039;, & 039; r & 039;); $ buf = fgetcsv ($ hd, 1000, & 039 ;, & 039;); open a testcsv & amp; 26684;
Php issues with extracting strings from csv files and solutions: Use the fgetcsv () function to extract csv & #26684; format data. Secret & #26684; type file, the content in the file is separated by & quot;, & quot. The first line indicates the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.